target = 2048
srcs = $(wildcard *.c)
objs = $(patsubst %.c, %.o, $(srcs))
CC = gcc
CFLAGS = -O3 -Wall

$(target): $(objs)
	@echo "\e[93m生成可执行文件：$@\e[0m"
	@$(CC) $^ -o $@
	@echo "\e[95m生成可执行文件：$@完成\e[0m"

%.o: %.c *.h
	@echo "\e[93m生成目标文件：$@\e[0m"
	@$(CC) -c -o $@ $< $(CFLAGS)
	@echo "\e[95m生成目标文件$@完成\e[0m"

.PHONY: clean
clean:
	@rm -rf *.o